<template>
  <div class="top-nav" v-show="bar">
    <div class="icon-back">
      <a href="" @click="back"></a>
    </div>
    <div class="nav-title">返回书架</div>
  </div>
</template>

<script type="text/ecmascript-6">
  import {mapState} from 'vuex'
  export default {
    methods: {
      back() {
        this.$router.go(-1)
      }
    },
    computed: {
      ...mapState([
        'bar'
      ])
    }
  }
</script>

<style lang="less" type="text/less">
  .top-nav {
    position: fixed;
    top: 0px;
    height: 50px;
    background: #000;
    width: 100%;
    opacity: 1;
    z-index: 9;

    .icon-back {
      position: absolute;
      top: 14px;
      left: 10px;
      width: 23px;
      height: 23px;
      background: url();
      background-size: contain;
      a {
        display: block;
        width:100%;
        height:100%;
      }
    }

    .nav-title {
      position: absolute;
      top: 17px;
      left: 40px;
      color: #fff;
      font-size: 10px;
    }

  }
</style>
